
package nav;

import java.util.ArrayList;

public class StreetTopologyObjectImpl implements ITopologyObject {

	private String id;
	
	private String realname;
	
	private ArrayList<CoordinateTopologyObjectImpl> linePoints;
	
    public StreetTopologyObjectImpl(String id, String realname) {
    	this.id = id;
    	this.realname = realname;
    	linePoints=new ArrayList<CoordinateTopologyObjectImpl>();
    }

    
    public void addLinePoint(CoordinateTopologyObjectImpl point){
    	linePoints.add(point);
    }
    

    public String getID(){
    	return id;
    }

    @Override
    public String toString(){
    	
    	String points="";
    	for (CoordinateTopologyObjectImpl c : linePoints) {
    		points += "X: " + c.getX() + ", Y: " + c.getY()+ ";   ";
			
		}
    	return id+", "+realname+", Points:   "+points;
    }

    public String getRealName(){
    	return realname;
    }
    
    public ArrayList<CoordinateTopologyObjectImpl> getLinePoints(){
    	return linePoints;
    }
    
    public boolean hasLinePoint(CoordinateTopologyObjectImpl point){
		boolean ret = false;
    	for(CoordinateTopologyObjectImpl linePoint:linePoints){
			if(point.equals(linePoint))
				ret = true;
		}
    	
    	return ret;
    }
}
